package com.hr.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hr.entity.ConfigMajor;
import com.hr.mapper.ConfigMajorMapper;
import com.hr.service.ConfigMajorService;
import com.hr.service.ConfigPublicCharService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConfigMajorServiceImpl implements ConfigMajorService {
    @Autowired
    private ConfigMajorMapper configMajorMapper;

    /**
     *查询职位设置
     * @return
     */
    @Override
    public List<ConfigMajor> queryList() {
        QueryWrapper<ConfigMajor> queryWrapper = new QueryWrapper<ConfigMajor>();
        return configMajorMapper.selectList(queryWrapper);
    }

    /**
     * 删除
     * @param makid
     * @return
     */
    @Override
    public boolean del(Integer makid) {
        int i = configMajorMapper.deleteById(makid);
        return i>0;
    }

    /**
     * 保存/修改
     * @param configMajor
     * @return
     */
    @Override
    public boolean save(ConfigMajor configMajor) {
        int insert=0;
        if(configMajor.getMakid()==null){
             insert = configMajorMapper.insert(configMajor);
        }else{
            insert = configMajorMapper.updateById(configMajor);
        }
        return insert>0;
    }
    //    @Override
//    public List<ConfigMajor> queryList() {
//        QueryWrapper<ConfigMajor> queryWrapper = new QueryWrapper<ConfigMajor>();
//        List<ConfigMajor> list = configMajorMapper.selectList(queryWrapper);
//        return list;
//    }
}
